<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>자유게시판</title>
<style type="text/css">
.basicBtn {
	font-size:12px;
	font-family:Verdana;
	font-weight:bold;
	-moz-border-radius:2px;
	-webkit-border-radius:2px;
	border-radius:2px;
	border:1px solid #dcdcdc;
	padding:5px 10px;
	text-decoration:none;
	background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #d9d5d9), color-stop(100%, #bababa) );
	background:-moz-linear-gradient( center top, #d9d5d9 5%, #bababa 100% );
	background:-ms-linear-gradient( top, #d9d5d9 5%, #bababa 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d9d5d9', endColorstr='#bababa');
	background-color:#d9d5d9;
	color:#4f4f4f;
	display:inline-block;
	text-shadow:0px 0px 0px #ffffff;
 	-webkit-box-shadow:inset 0px 0px 0px 0px #ffffff;
 	-moz-box-shadow:inset 0px 0px 0px 0px #ffffff;
 	box-shadow:inset 0px 0px 0px 0px #ffffff;
}.basicBtn:hover {
	background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #bababa), color-stop(100%, #d9d5d9) );
	background:-moz-linear-gradient( center top, #bababa 5%, #d9d5d9 100% );
	background:-ms-linear-gradient( top, #bababa 5%, #d9d5d9 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bababa', endColorstr='#d9d5d9');
	background-color:#bababa;
}.basicBtn:active {
	position:relative;
	top:1px;
}

#board {
	margin:0px;padding:0px;
	width:80%;
}
#board table{
    border-collapse: collapse;
    border-spacing: 0;
	width:100%;
	height:100%;
	margin:0px;
	padding:0px;
}
#board td{
	vertical-align:middle;
	
	background-color:#ffffff;

	border:1px solid #000000;
	border-width:0px 1px 1px 0px;
	text-align:left;
	padding:7px;
	font-size:15px;
	font-family:NanumGothic;
	font-weight:normal;
	color:#000000;
}
#board tr:first-child th{
	background:-o-linear-gradient(bottom, #cccccc 5%, #b2b2b2 100%);	
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #cccccc), color-stop(1, #b2b2b2) );
	background:-moz-linear-gradient( center top, #cccccc 5%, #b2b2b2 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#cccccc", endColorstr="#b2b2b2");	background: -o-linear-gradient(top,#cccccc,b2b2b2);

	background-color:#cccccc;
	border:0px solid #000000;
	text-align:center;
	border-width:0px 0px 1px 1px;
	font-size:14px;
	font-family:Arial;
	font-weight:bold;
	color:#000000;
	height: 30px;
}
#board tr:first-child:hover td{
	background:-o-linear-gradient(bottom, #cccccc 5%, #b2b2b2 100%);	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #cccccc), color-stop(1, #b2b2b2) );
	background:-moz-linear-gradient( center top, #cccccc 5%, #b2b2b2 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#cccccc", endColorstr="#b2b2b2");	background: -o-linear-gradient(top,#cccccc,b2b2b2);

	background-color:#cccccc;
}
</style>

<script type="text/javascript">
	function writego(boardNo,page){
		location.href="writeGo_board.do?boardNo="+boardNo+"&page="+page;
	}
	function selectFind(boardNo){
		var s = document.selectForm.findSelect;
		var text = document.selectForm.search;
		if(text.value==""){
			alert("검색어를 입력해주세요");
			return false;
		}
		if(s.value==""){
			alert("검색 주제를 선택해주세요");
			return false;
		}
		location.href = "searchBoard_board.do?select="+s.value+"&content="+text.value+"&boardNo="+boardNo;
	}
</script>
</head>
<body>
<center>
<img src="${initParam.root}/img/${requestScope.boardName}.jpg">

<form name = "selectForm" method="post">
<select id = findSelect >
	<option>--------</option>
	<option value="title">제목</option>
	<c:if test="${requestScope.boardNo!=21 }">
		<option value="content">내용</option>
	</c:if>
	<option value="nick">닉네임</option>
</select>
 <input type="text" name="search">
 <input type="button" value="검색" class="basicBtn" onclick = "selectFind(${requestScope.boardNo})">
</form>
	<table border="1" id="board">
	<tr>
	<th>번호</th>
	<c:if test="${requestScope.boardNo==21 }">
		<th>미리보기</th>
	</c:if>
	<th>제목</th>
	<th>작성자</th>
	<th>작성일</th>
	<th>조회수</th>
	</tr>
	<c:forEach items="${requestScope.lvo.boardList}" var = "L">
	<tr>
	<td>${L.no }</td>
	<c:if test="${requestScope.boardNo==21 }">
		<td align="center">
			<img src = "${initParam.root}/img/upload/${L.newFileName}" height="100" width="60" align="middle">
		</td>
	</c:if>
	<td>
	
	<c:if test="${sessionScope.vo.grade!=null}">
	<c:if test="${sessionScope.vo.grade=='Manager'||sessionScope.vo.grade=='SubManager'||sessionScope.vo.grade=='VIP'||sessionScope.vo.grade=='S'}">
		<a href="getContentView_board.do?no=${L.no}&page=${requestScope.lvo.pb.nowPage}&boardNo=${requestScope.boardNo}">${L.title }</a>
	</c:if>
		<c:if test="${sessionScope.vo.grade=='A' }">
			<c:choose>
				<c:when test="${requestScope.boardNo==14||requestScope.boardNo==15}" >
					<a href="readFail_board.do">${L.title }</a>
				</c:when>
				<c:otherwise>
					<a href="getContentView_board.do?no=${L.no}&page=${requestScope.lvo.pb.nowPage}&boardNo=${requestScope.boardNo}">${L.title }</a>
				</c:otherwise>
			</c:choose>
		</c:if>
		<c:if test="${sessionScope.vo.grade=='F' }">
			<c:choose>
				<c:when test="${requestScope.boardNo==11||requestScope.boardNo==12||requestScope.boardNo==14||requestScope.boardNo==15}" >
					<a href="readFail_board.do">${L.title }</a>
				</c:when>
				<c:otherwise>
					<a href="getContentView_board.do?no=${L.no}&page=${requestScope.lvo.pb.nowPage}&boardNo=${requestScope.boardNo}">${L.title }</a>
				</c:otherwise>
			</c:choose>
		</c:if>
</c:if>
<c:if test="${sessionScope.vo.grade==null}">
${L.title }
</c:if>

	</td>
	<td>${L.memberVO.nick }</td>
	<td>${L.writeDate }</td>
	<td>${L.viewCount}</td>
	</tr>
	</c:forEach>
	</table> <br>
	
	<ul id="css_page">
	<c:set var="pb" value="${requestScope.lvo.pb}"></c:set>
	<c:if test="${pb.previousPageGroup}">
	<li><a href="allView_board.do?page=${pb.startPageOfPageGroup-1 }&boardNo=${requestScope.boardNo}">
	◀</a></li>
	</c:if>	 
	 <c:forEach var="i" begin="${pb.startPageOfPageGroup}" 
	  end="${pb.endPageOfPageGroup}">
	  <c:choose>
	  		<c:when test="${pb.nowPage!=i}">
	  		   	<li><a href="allView_board.do?page=${i}&boardNo=${requestScope.boardNo}">${i}</a></li>
	  		</c:when>
	  		<c:otherwise>
	  		    <li>${i}</li>
	  		</c:otherwise>
	  </c:choose>	 		
	 </c:forEach>
	  <c:if test="${pb.nextPageGroup }">
	  <li><a href="allView_board.do?page=${pb.endPageOfPageGroup+1}&boardNo=${requestScope.boardNo}">▶</a></li>
	  </c:if>
	  </ul>
	  <br><br>
<c:if test="${sessionScope.vo.grade!=null}">
		<c:if test="${sessionScope.vo.grade=='Manager'||sessionScope.vo.grade=='SubManager' }">
			<input type="button" value="글쓰기" class="basicBtn" onclick="writego(${requestScope.boardNo}, ${requestScope.page})">
		</c:if>
		<c:if test="${sessionScope.vo.grade=='VIP' }">
			<c:choose>
				<c:when test="${requestScope.boardNo==16||requestScope.boardNo==17||requestScope.boardNo==18}" >
					글쓰기기능을 위한 회원등급을 올리세요
				</c:when>
				<c:otherwise>
					<input type="button" value="글쓰기" class="basicBtn" onclick="writego(${requestScope.boardNo}, ${requestScope.page})">
				</c:otherwise>
			</c:choose>
		</c:if>
		<c:if test="${sessionScope.vo.grade=='S' }">
			<c:choose>
				<c:when test="${requestScope.boardNo==16||requestScope.boardNo==17||requestScope.boardNo==18||requestScope.boardNo==15}" >
					글쓰기기능을 위한 회원등급을 올리세요
				</c:when>
				<c:otherwise>
					<input type="button" value="글쓰기" class="basicBtn" onclick="writego(${requestScope.boardNo}, ${requestScope.page})">
				</c:otherwise>
			</c:choose>
		</c:if>
		<c:if test="${sessionScope.vo.grade=='A' }">
			<c:choose>
				<c:when test="${requestScope.boardNo==14||requestScope.boardNo==15||requestScope.boardNo==16||requestScope.boardNo==17||requestScope.boardNo==18}" >
					글쓰기기능을 위한 회원등급을 올리세요
				</c:when>
				<c:otherwise>
					<input type="button" value="글쓰기" class="basicBtn" onclick="writego(${requestScope.boardNo}, ${requestScope.page})">
				</c:otherwise>
			</c:choose>
		</c:if>
</c:if>
<c:if test="${sessionScope.vo.grade==null}">
로그인을 해주세요
</c:if>
</center>
</body>
</html>